﻿#ifndef __MCVECTOR2D_H_
#define __MCVECTOR2D_H_

class MCPoint2D;

class MCVector2
{
public:

    MCVector2();
    MCVector2(double x_, double y_);
    MCVector2(const MCVector2 &vector);
    MCVector2(const MCPoint2D &point);

    double magnitude() const; // Длина вектора
    MCVector2 normalize() const; // Возвращает нормализированный вектор
    double dot(const MCVector2 &other) const; // Скалярное произведение
    MCVector2 cross(const MCVector2 &other) const; // Векторное произведение
    double crossProduct(const MCVector2 &other) const;
    double angle(const MCVector2 &other) const; // Угол между двумя векторами (в радианах) [0, Pi]
    double clockwiseAngle(const MCVector2 &other) const; // Угол между двумя векторами (в радианах) [-Pi, Pi]
    bool collinear(const MCVector2 &vec);

    static MCVector2 rotate(const MCVector2 &vec, double angleInRadian);

    MCVector2 operator+(const MCVector2 &other) const;
    MCVector2 operator-(const MCVector2 &other) const;
    MCVector2 operator*(double scalar) const;
    MCVector2 operator/(double scalar) const;
    MCVector2 &operator=(const MCPoint2D &other);
    bool operator==(const MCVector2 &other) const;
    bool operator!=(const MCVector2 &other) const;
    bool operator==(const MCPoint2D &other) const;
    bool operator!=(const MCPoint2D &other) const;

public:

    double x;
    double y;

};

#endif // !__MCVECTOR2D_H_
